package com.yanqu.road.server.cmd.tradewar.cross;

import com.yanqu.road.pb.cross.tradewar.CrossTradeWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.cross.CrossDataMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.manger.union.GameUnionActivityGroupMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_TRADE_WAR_NOTICE_LIST, desc = "跨服商战公告")
public class CrossTradeWarNoticeListCmd extends AbstractCommand {

	private int activityId;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		CrossTradeWarProto.CrossTradeWarNoticeListReqMsg reqMsg = CrossTradeWarProto.CrossTradeWarNoticeListReqMsg.parseFrom(packet.getBytes());
		activityId = reqMsg.getActivityId();
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

	}

	@Override
	public void sendData(GamePlayer player) {
		int groupId = GameUnionActivityGroupMgr.getGroupId(activityId, player.getUserId());
		player.sendPacket(Protocol.U_CROSS_TRADE_WAR_NOTICE_LIST, CrossDataMgr.getCrossTradeWarNoticeListMsg(activityId,groupId));
	}
}
